package io.renren.utils;

import org.springframework.util.ObjectUtils;

import java.util.List;

/**
 * Title:       ValidationUtil
 * Description:
 *
 * @author : liugaoyang
 * date         : 2019/7/12 14:24
 */
public class ValidationUtil {

    /**
     * 字符串是否为空
     * @param str
     * @return
     */
    public static boolean isBlank(String str){
        if(str == null || str.trim().equals("")){
            return true;
        } else {
            return false;
        }
    }

    /**
     * 字符串是否不为空
     * @param str
     * @return
     */
    public static boolean isNotBlank(String str){
        if(str != null && !str.trim().equals("")){
            return true;
        } else {
            return false;
        }
    }

    public static boolean isNotNull(Object obj) {
        if(!ObjectUtils.isEmpty(obj)){
            return true;
        } else {
            return false;
        }
    }

    public static boolean isNull(Object obj) {
        if(ObjectUtils.isEmpty(obj)){
            return true;
        } else {
            return false;
        }
    }

    public static boolean isEmptyList(List list){
        if(list == null || list.isEmpty()){
            return true;
        } else {
            return false;
        }
    }

    public static boolean isNotEmptyList(List list){
        if(list != null && !list.isEmpty()){
            return true;
        } else {
            return false;
        }
    }

}
